package com.platform.enums;

import lombok.Getter;

/**
 * Description: 部门类型
 *
 * @author libin Created on 2019/8/28
 **/
public enum DepartType {
    /**
     * 类型
     */
    DOMAIN("区域"), NORMAL("机构"), DEPART("部门"), POSITION("岗位");

    @Getter
    private final String text;

    DepartType(String text) {
        this.text = text;
    }

    public static DepartType parse(String text) {
        if (DOMAIN.getText().equals(text)) {
            return DOMAIN;
        } else if (NORMAL.getText().equals(text)) {
            return NORMAL;
        } else {
            return null;
        }
    }

    public static DepartType valuesOf(String name) {
        for(DepartType type : DepartType.values()){
            if(type.name().equalsIgnoreCase(name)){
                return type;
            }
        }
        return null;
    }
}
